<?php

declare(strict_types=1);

namespace app\start\model;

use lite\model\BaseModel;

class PostImageModel extends BaseModel
{
    protected $name = 'start_post_image';

    // 自动数据类型转换
    protected $type = [];

    // 自动 json 转换
    protected $json = [];


    public static function insertImage($postId,$images=[])
    {
        $data = [];
        foreach($images as $v){
            $data[] = [
                'post_id'=>$postId,
                'url'=>$v['url'],
            ];
        }
        (new static)->insertAll($data);
    }
}